package org.shoukaiseki.test.spring.multiple.datasource;

import org.shoukaiseki.test.spring.multiple.datasource.config.mappers.OneMapper;
import org.shoukaiseki.test.spring.multiple.datasource.config.mappers.TwoMapper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Controller
public class HelloController {

    @Resource
    OneMapper oneMapper;

    @Resource
    TwoMapper twoMapper;


    @RequestMapping( value="/hello")
    @ResponseBody
    public Map<String, String> hello(){
        Map<String, String> result = new HashMap<>();
        result.put("Mapper", "Database version");
        result.put("oneMapper", oneMapper.getVersion());
        result.put("twoMapper", twoMapper.getVersion());
        result.put("oneDataBase",oneMapper.showDataBase());
        result.put("twoDataBase",twoMapper.showDataBase());
        return result;
    }


}
